<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [
            [],
            [],
            [],
            [],
            []
        ]
        var m = 0
        for(var i=0;i<5;i++){
            for(var j=0;j<5;j++){   
                m++
                arr[i][j] = m
            }
        }
        console.log(arr)
        var arr1 = []
        var k =0
            for(var i=0;i<5;i++){
                arr[i].splice(i+1,arr.length)
        }
        
        
        // var k = 0
        // for(var i=0;i<5;i++){
        //     for(var j=0;j<5;j++){   
        //         k++
        //         if(j<i+1){
        //             arr[i][j] = k
        //         }
        //     }
        // }
        console.log(arr)
    </script>
</body>
</html>